<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"      
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

    <h:body>
        <ui:composition template="./../templates/templateNECS.xhtml">

            <ui:define name="top">
                Lista de todas as encomendas
            </ui:define>

            <ui:define name="left">
                <h:outputLink value="admin_encomenda_criar.xhtml">Criar Encomenda</h:outputLink>
                <br></br>
                <h:outputLink value="admin_encomenda_listar.xhtml">Lista de Encomendas</h:outputLink>
                <br></br>
                <h:outputLink value="admin_produto_catalogo_listar.xhtml">Lista de Produtos Catálogo</h:outputLink>
                <br></br>
                <h:outputLink value="admin_produtos_fisicos_listar.xhtml">Lista de Produtos Físicos</h:outputLink>
                <br></br>

            </ui:define>

            
            <ui:define name="content">
                <h:form>                    
                    <h:commandButton value="Criar encomendas" action="admin_encomenda_criar?faces-redirect=true" />
                    <br/>

                    <h:dataTable
                        var="encomenda"
                        summary="Lista de todos as encomendas"
                        value="#{administradorManager.encomendas}"
                        rules="all"
                        cellpadding="5">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Encomenda" />
                            </f:facet>
                            <h:commandLink
                                value="Editar"
                                action="admin_encomenda_editar?faces-redirect=true">
                                <f:setPropertyActionListener target="#{administradorManager.encomendaAtual}" value="#{encomenda}" />
                            </h:commandLink>                            
                        </h:column>                        
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="ID" />
                            </f:facet>
                            <h:outputText value="#{encomenda.id}" />
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Data" />
                            </f:facet>
                            <h:outputText value="#{encomenda.dataEncomenda}" />
                        </h:column>    
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="Codigo Farmácia" />
                            </f:facet>
                                <h:outputText value="#{encomenda.codFarmacia}" />
                        </h:column>     
                    </h:dataTable>
                </h:form>		
            </ui:define>
        </ui:composition>
    </h:body>
</html>
